let vm = new Vue({
    el: '.main-content',
    data: {
        resInfo: {}
    },
    methods: {

        findById: function (id) {
            axios.get("/guguanjia/resource/get?id=" + id).then(function (resp) {
                vm.$data.resInfo = resp.data;
            })
        },
        toSelect: function (mid) {
            layer.aid = mid;
            console.log(mid);
            layer.open({
                type: 2,
                title: false,
                area: ['70%', '70%'],
                content: '/guguanjia/resource/toSelect',
                end: () => {
                    if(layer.parentName !=undefined && layer.parentName.length>0){
                        this.resInfo.parentName=layer.parentName;
                        this.resInfo.parentId=layer.mid;
                        console.log(123456)
                        console.log(this.resInfo.parentName=layer.parentName)
                    }
                }
            })
        },

        toModules: function () {
            layer.open({
                type: 2,
                title: false,
                area: ['70%', '70%'],
                content: '/guguanjia/area/toModules',
                end: () => {
                    if (layer.icon !== 0 && layer.icon.length > 0) {
                        this.resInfo.icon = layer.icon;
                    }
                }
            })
        },

        //修改
        doUpdate:function (resource) {
            axios({
                url: "/guguanjia/resource/updateById",
                method: "POST",
                data: resource,
            }).then(response=>{
                let index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index)
            }).catch(error=>{
                layer.msg(error.message)
            })
        },


        cancel: function () {
            let index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index)
        }
    },
    created:function () {
        this.resInfo=parent.layer
    }
});

function abcdefgh(data) {
    vm.findById(data)
}